const Event = function () {
  this.obj = {}
}
Event.prototype.on = function(eventType, fn) {
  if(!this.obj[eventType]) {
    this.obj[eventType] = []
  }
  this.obj[eventType].push(fn)
}
Event.prototype.emit = function() {
  var eventType = Array.prototype.shift.apply(arguments)
  var arr = this.obj[eventType]
  for (let i = 0; i < arr.length; i++) {
    arr[i].apply(arr[i], arguments)
  }
}

const event = new Event()
event.on('click', (name) => {
  console.log(`hello, ${name}`)
})
event.on('click', (name) => {
  console.log(`i love you, ${name}`)
})
event.emit('click', 'xjt')